There are two interesting methods: .call() and .bind()
Using function.call() it’s possible to specify what the
this
value will be.There’s also a more modern function.bind() which returns a new function. This one also has a
this
that can be specified.You can also do
function.bind(function, alreadySetValue)
for partial functions with pre specified arguments.